home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / userconf / user1.c < prev    next >
C/C++ Source or Header  |  1995-08-10  |  762b  |  39 lines

  1. #include "userconf.h"
  2.  
  3. /*
  4.     Find out if a user account is of the same category than another
  5.     one.
  6.  
  7.     If other == NULL, it is assumed to be a normal ordinary user.
  8. */
  9. PUBLIC int USER::is_like (USER *other)
  10. {
  11.     int ret = 0;
  12.     if (!special){
  13.         if (other == NULL){
  14.             ret = !is_admin();
  15.         }else if (!other->special){
  16.             ret = is_admin() == other->is_admin();
  17.         }
  18.     }else if (other != NULL && other->special){
  19.         ret = strcmp(shell.get(),other->getshell())==0;
  20.     }
  21.     return ret;
  22. }
  23.  
  24.  
  25. /*
  26.     Set the default information of an account from another.
  27. */
  28. PUBLIC void USER::setlike (USER *other)
  29. {
  30.     if (other != NULL){
  31.         shell.setfrom (other->getshell());
  32.         wrkdir.setfrom (other->wrkdir.get());
  33.         special = other->is_special();
  34.         uid = other->getuid();
  35.         gid = other->getgid();
  36.     }
  37. }
  38.  
  39.